package com.homework.service;

import java.sql.SQLException;

import com.homework.bean.CourseBean;
import com.homework.bean.PageInfoBean;
import com.homework.bean.ResourceBean;
import com.homework.bean.UserBean;
import com.homework.bean.UserResourceListBean;
import com.homework.dao.ResourceDao;

public class ResourceService {

	private static ResourceService resourceService;
	private static ResourceDao resourceDao;

	public ResourceService() {
		resourceDao = new ResourceDao();
	}

	public static ResourceService getInstance() {
		if (resourceService == null) {
			resourceService = new ResourceService();
		}
		return resourceService;
	}

	// 资源列表
	public UserResourceListBean resourceShow(CourseBean courseBean,
			PageInfoBean pageInfoBean) throws SQLException {
		return resourceDao.resourceShow(courseBean, pageInfoBean);
	}

	// 资源上传
	public void resourceUpload(UserBean userBean, CourseBean courseBean,
			ResourceBean resourceBean) {
		resourceDao.resourceUpload(userBean, courseBean, resourceBean);
	}
	
	// 资源下载
	public String resourceDownload(ResourceBean resourceBean) throws SQLException {
		return resourceDao.resourceDownload(resourceBean);
	}
}
